import { IMessage, IRequest, IResponse } from "../../../Share/Module/Message/IMessage";
import { IActorMessage, IActorRequest, IActorResponse } from "../../../Share/Module/Actor/IActorMessage";
import { IActorLocationMessage, IActorLocationRequest, IActorLocationResponse } from "../../../Share/Module/ActorLocation/IActorLocationMessage";
import { MessageAttribute, ResponseTypeAttribute } from "../../../../../Decorator/Decorator";

export class InnerMessage {
    public static readonly ObjectQueryResponse: number = 20002;
    public static readonly ObjectQueryRequest: number = 20003;
    public static readonly A2M_Reload: number = 20004;
    public static readonly M2A_Reload: number = 20005;
    public static readonly G2G_LockResponse: number = 20006;
    public static readonly G2G_LockRequest: number = 20007;
    public static readonly G2G_LockReleaseResponse: number = 20008;
    public static readonly G2G_LockReleaseRequest: number = 20009;
    public static readonly ObjectAddResponse: number = 20010;
    public static readonly ObjectAddRequest: number = 20011;
    public static readonly ObjectLockResponse: number = 20012;
    public static readonly ObjectLockRequest: number = 20013;
    public static readonly ObjectUnLockResponse: number = 20014;
    public static readonly ObjectUnLockRequest: number = 20015;
    public static readonly ObjectRemoveResponse: number = 20016;
    public static readonly ObjectRemoveRequest: number = 20017;
    public static readonly ObjectGetResponse: number = 20018;
    public static readonly ObjectGetRequest: number = 20019;
    public static readonly G2R_GetLoginKey: number = 20020;
    public static readonly R2G_GetLoginKey: number = 20021;
    public static readonly G2M_SessionDisconnect: number = 20022;
    public static readonly M2M_UnitTransferResponse: number = 20023;
    public static readonly M2M_UnitTransferRequest: number = 20024;
    public static readonly L2A_LoginAccountResponse: number = 20025;
    public static readonly A2L_LoginAccountRequest: number = 20026;
    public static readonly G2L_DisconnectGateUnit: number = 20027;
    public static readonly L2G_DisconnectGateUnit: number = 20028;
    public static readonly R2A_GetRealmKey: number = 20029;
    public static readonly A2R_GetRealmKey: number = 20030;
    public static readonly G2R_GetLoginGateKey: number = 20031;
    public static readonly R2G_GetLoginGateKey: number = 20032;
    public static readonly L2G_AddLoginRecord: number = 20033;
    public static readonly G2L_AddLoginRecord: number = 20034;
    public static readonly M2G_RequestEnterGameState: number = 20035;
    public static readonly G2M_RequestEnterGameState: number = 20036;
    public static readonly M2G_RequestExitGame: number = 20037;
    public static readonly G2M_RequestExitGame: number = 20038;
    public static readonly L2G_RemoveLoginRecord: number = 20039;
    public static readonly G2L_RemoveLoginRecord: number = 20040;
    public static readonly UnitCache2Other_AddOrUpdateUnit: number = 20041;
    public static readonly Other2UnitCache_AddOrUpdateUnit: number = 20042;
    public static readonly UnitCache2Other_GetUnit: number = 20043;
    public static readonly Other2UnitCache_GetUnit: number = 20044;
    public static readonly UnitCache2Other_DeleteUnit: number = 20045;
    public static readonly Other2UnitCache_DeleteUnit: number = 20046;
}

@MessageAttribute(InnerMessage.ObjectQueryResponse)
export class ObjectQueryResponse extends IActorResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    Entity: Uint8Array;
}

@ResponseTypeAttribute(ObjectQueryResponse)
@MessageAttribute(InnerMessage.ObjectQueryRequest)
export class ObjectQueryRequest extends IActorRequest {
    RpcId: number;
    Key: number;
    InstanceId: number;
}

@MessageAttribute(InnerMessage.A2M_Reload)
export class A2M_Reload extends IActorResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
}

@ResponseTypeAttribute(A2M_Reload)
@MessageAttribute(InnerMessage.M2A_Reload)
export class M2A_Reload extends IActorRequest {
    RpcId: number;
}

@MessageAttribute(InnerMessage.G2G_LockResponse)
export class G2G_LockResponse extends IActorResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
}

@ResponseTypeAttribute(G2G_LockResponse)
@MessageAttribute(InnerMessage.G2G_LockRequest)
export class G2G_LockRequest extends IActorRequest {
    RpcId: number;
    Id: number;
    Address: string;
}

@MessageAttribute(InnerMessage.G2G_LockReleaseResponse)
export class G2G_LockReleaseResponse extends IActorResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
}

@ResponseTypeAttribute(G2G_LockReleaseResponse)
@MessageAttribute(InnerMessage.G2G_LockReleaseRequest)
export class G2G_LockReleaseRequest extends IActorRequest {
    RpcId: number;
    Id: number;
    Address: string;
}

@MessageAttribute(InnerMessage.ObjectAddResponse)
export class ObjectAddResponse extends IActorResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
}

@ResponseTypeAttribute(ObjectAddResponse)
@MessageAttribute(InnerMessage.ObjectAddRequest)
export class ObjectAddRequest extends IActorRequest {
    RpcId: number;
    Key: number;
    InstanceId: number;
}

@MessageAttribute(InnerMessage.ObjectLockResponse)
export class ObjectLockResponse extends IActorResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
}

@ResponseTypeAttribute(ObjectLockResponse)
@MessageAttribute(InnerMessage.ObjectLockRequest)
export class ObjectLockRequest extends IActorRequest {
    RpcId: number;
    Key: number;
    InstanceId: number;
    Time: number;
}

@MessageAttribute(InnerMessage.ObjectUnLockResponse)
export class ObjectUnLockResponse extends IActorResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
}

@ResponseTypeAttribute(ObjectUnLockResponse)
@MessageAttribute(InnerMessage.ObjectUnLockRequest)
export class ObjectUnLockRequest extends IActorRequest {
    RpcId: number;
    Key: number;
    OldInstanceId: number;
    InstanceId: number;
}

@MessageAttribute(InnerMessage.ObjectRemoveResponse)
export class ObjectRemoveResponse extends IActorResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
}

@ResponseTypeAttribute(ObjectRemoveResponse)
@MessageAttribute(InnerMessage.ObjectRemoveRequest)
export class ObjectRemoveRequest extends IActorRequest {
    RpcId: number;
    Key: number;
}

@MessageAttribute(InnerMessage.ObjectGetResponse)
export class ObjectGetResponse extends IActorResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    InstanceId: number;
}

@ResponseTypeAttribute(ObjectGetResponse)
@MessageAttribute(InnerMessage.ObjectGetRequest)
export class ObjectGetRequest extends IActorRequest {
    RpcId: number;
    Key: number;
}

@MessageAttribute(InnerMessage.G2R_GetLoginKey)
export class G2R_GetLoginKey extends IActorResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    Key: number;
    GateId: number;
}

@ResponseTypeAttribute(G2R_GetLoginKey)
@MessageAttribute(InnerMessage.R2G_GetLoginKey)
export class R2G_GetLoginKey extends IActorRequest {
    RpcId: number;
    Account: string;
}

@MessageAttribute(InnerMessage.G2M_SessionDisconnect)
export class G2M_SessionDisconnect extends IActorLocationMessage {
    RpcId: number;
}

@MessageAttribute(InnerMessage.M2M_UnitTransferResponse)
export class M2M_UnitTransferResponse extends IActorResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    NewInstanceId?: number;
}

@ResponseTypeAttribute(M2M_UnitTransferResponse)
@MessageAttribute(InnerMessage.M2M_UnitTransferRequest)
export class M2M_UnitTransferRequest extends IActorRequest {
    RpcId: number;
    OldInstanceId: number;
    Unit: Uint8Array;
    Entitys: Uint8Array[];
}

@MessageAttribute(InnerMessage.L2A_LoginAccountResponse)
export class L2A_LoginAccountResponse extends IActorResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
}

@ResponseTypeAttribute(L2A_LoginAccountResponse)
@MessageAttribute(InnerMessage.A2L_LoginAccountRequest)
export class A2L_LoginAccountRequest extends IActorRequest {
    RpcId: number;
    AccountId: number;
}

@MessageAttribute(InnerMessage.G2L_DisconnectGateUnit)
export class G2L_DisconnectGateUnit extends IActorResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
}

@ResponseTypeAttribute(G2L_DisconnectGateUnit)
@MessageAttribute(InnerMessage.L2G_DisconnectGateUnit)
export class L2G_DisconnectGateUnit extends IActorRequest {
    RpcId: number;
    AccountId: number;
}

@MessageAttribute(InnerMessage.R2A_GetRealmKey)
export class R2A_GetRealmKey extends IActorResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    RealmKey: string;
}

@ResponseTypeAttribute(R2A_GetRealmKey)
@MessageAttribute(InnerMessage.A2R_GetRealmKey)
export class A2R_GetRealmKey extends IActorRequest {
    RpcId: number;
    AccountId: number;
}

@MessageAttribute(InnerMessage.G2R_GetLoginGateKey)
export class G2R_GetLoginGateKey extends IActorResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    GateSessionKey: string;
}

@ResponseTypeAttribute(G2R_GetLoginGateKey)
@MessageAttribute(InnerMessage.R2G_GetLoginGateKey)
export class R2G_GetLoginGateKey extends IActorRequest {
    RpcId: number;
    AccountId: number;
}

@MessageAttribute(InnerMessage.L2G_AddLoginRecord)
export class L2G_AddLoginRecord extends IActorResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
}

@ResponseTypeAttribute(L2G_AddLoginRecord)
@MessageAttribute(InnerMessage.G2L_AddLoginRecord)
export class G2L_AddLoginRecord extends IActorRequest {
    RpcId: number;
    AccountId: number;
    ServerId: number;
}

@MessageAttribute(InnerMessage.M2G_RequestEnterGameState)
export class M2G_RequestEnterGameState extends IActorLocationResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
}

@ResponseTypeAttribute(M2G_RequestEnterGameState)
@MessageAttribute(InnerMessage.G2M_RequestEnterGameState)
export class G2M_RequestEnterGameState extends IActorLocationRequest {
    RpcId: number;
}

@MessageAttribute(InnerMessage.M2G_RequestExitGame)
export class M2G_RequestExitGame extends IActorLocationResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
}

@ResponseTypeAttribute(M2G_RequestExitGame)
@MessageAttribute(InnerMessage.G2M_RequestExitGame)
export class G2M_RequestExitGame extends IActorLocationRequest {
    RpcId: number;
}

@MessageAttribute(InnerMessage.L2G_RemoveLoginRecord)
export class L2G_RemoveLoginRecord extends IActorResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
}

@ResponseTypeAttribute(L2G_RemoveLoginRecord)
@MessageAttribute(InnerMessage.G2L_RemoveLoginRecord)
export class G2L_RemoveLoginRecord extends IActorRequest {
    RpcId: number;
    AccountId: number;
    ServerId: number;
}

@MessageAttribute(InnerMessage.UnitCache2Other_AddOrUpdateUnit)
export class UnitCache2Other_AddOrUpdateUnit extends IActorResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
}

@ResponseTypeAttribute(UnitCache2Other_AddOrUpdateUnit)
@MessageAttribute(InnerMessage.Other2UnitCache_AddOrUpdateUnit)
export class Other2UnitCache_AddOrUpdateUnit extends IActorRequest {
    RpcId: number;
    UnitId: number;
    EntityTypes?: string[];
    EntityBytes?: Uint8Array[];
}

@MessageAttribute(InnerMessage.UnitCache2Other_GetUnit)
export class UnitCache2Other_GetUnit extends IActorResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
    EntityList?: Uint8Array[];
    ComponentNameList?: string[];
}

@ResponseTypeAttribute(UnitCache2Other_GetUnit)
@MessageAttribute(InnerMessage.Other2UnitCache_GetUnit)
export class Other2UnitCache_GetUnit extends IActorRequest {
    RpcId: number;
    UnitId: number;
    ComponentNameList?: string[];
}

@MessageAttribute(InnerMessage.UnitCache2Other_DeleteUnit)
export class UnitCache2Other_DeleteUnit extends IActorResponse {
    RpcId: number;
    Error?: number;
    Message?: string;
}

@ResponseTypeAttribute(UnitCache2Other_DeleteUnit)
@MessageAttribute(InnerMessage.Other2UnitCache_DeleteUnit)
export class Other2UnitCache_DeleteUnit extends IActorRequest {
    RpcId: number;
    UnitId: number;
}
